<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    {template 'stourtravel/public/public_min_js'}
    {php echo Common::getCss('base.css,order.css'); }
    {php echo Common::getScript("DatePicker/WdatePicker.js"); }
<!--    <style>-->
<!--        /*.day_order_table .prev {*/-->
<!--        /*    background-position: -4px 0!important;*/-->
<!--        /*}*/-->
<!--        /*.day_order_table .next, .day_order_table .prev {*/-->
<!--        /*    width: 20px;*/-->
<!--        /*}*/-->
<!--        /*.day_order_table .next {*/-->
<!--        /*    background-position: left top!important;*/-->
<!--        /*}*/-->
<!--        /*.day_order_table .next_unvalid {*/-->
<!--        /*    background-position: left bottom !important;*/-->
<!--        /*}*/-->
<!--        .day_order_list{-->
<!--            width: 1300px;-->
<!--        }-->
<!--        .day_order_table{-->
<!--            width: 1045px;-->
<!--        }-->
<!--        .search_text{-->
<!--            width: 200px;-->
<!--            height: 28px;-->
<!--            padding: 0 5px;-->
<!--            vertical-align: top;-->
<!--            border: 1px solid #dedfe3;-->
<!--        }-->
<!--        .my_btn{-->
<!--            display: inline-block;-->
<!--            height: 28px;-->
<!--            line-height: 28px;-->
<!--            padding: 0 10px;-->
<!--            margin-left: 10px;-->
<!--            border: 1px solid #dedfe3;-->
<!--            background: #f7f7f7;-->
<!--        }-->
<!--    </style>-->
</head>

<body style="background-color: #fff">

<div class="pop_order_box">
    <div class="day_order_list">
        <dl>
            <dt>今日</dt>
            <dd>
                <span class="same">已付款</span>
                <span class="same today_2_num">0</span>
                <span class="price today_2_price">0</span>
            </dd>
            <dd>
                <span class="same">未付款</span>
                <span class="same today_1_num">0</span>
                <span class="price today_1_price">0</span>
            </dd>
            <dd class="bor_0">
                <span class="same">已取消</span>
                <span class="same today_3_num">0</span>
                <span class="price today_3_price">0</span>
            </dd>
        </dl>
        <dl>
            <dt>昨日</dt>
            <dd>
                <span class="same">已付款</span>
                <span class="same yesterday_2_num">0</span>
                <span class="price yesterday_2_price">0</span>
            </dd>
            <dd>
                <span class="same">未付款</span>
                <span class="same yesterday_1_num">0</span>
                <span class="price yesterday_1_price">0</span>
            </dd>
            <dd class="bor_0">
                <span class="same">已取消</span>
                <span class="same yesterday_3_num">0</span>
                <span class="price yesterday_3_price">0</span>
            </dd>
        </dl>
        <dl>
            <dt>最近7日</dt>
            <dd>
                <span class="same">已付款</span>
                <span class="same week_2_num">0</span>
                <span class="price week_2_price">0</span>
            </dd>
            <dd>
                <span class="same">未付款</span>
                <span class="same week_1_num">0</span>
                <span class="price week_1_price">0</span>
            </dd>
            <dd class="bor_0">
                <span class="same">已取消</span>
                <span class="same week_3_num">0</span>
                <span class="price week_3_price">0</span>
            </dd>
        </dl>
        <dl>
            <dt>最近30日</dt>
            <dd>
                <span class="same">已付款</span>
                <span class="same month_2_num">0</span>
                <span class="price month_2_price">0</span>
            </dd>
            <dd>
                <span class="same">未付款</span>
                <span class="same month_1_num">0</span>
                <span class="price month_1_price">0</span>
            </dd>
            <dd class="bor_0">
                <span class="same">已取消</span>
                <span class="same month_3_num">0</span>
                <span class="price month_3_price">0</span>
            </dd>
        </dl>
        <dl>
            <dt>全部</dt>
            <dd>
                <span class="same">已付款</span>
                <span class="same allyear_2_num">0</span>
                <span class="price allyear_2_price">0</span>
            </dd>
            <dd>
                <span class="same">未付款</span>
                <span class="same allyear_1_num">0</span>
                <span class="price allyear_1_price">0</span>
            </dd>
            <dd class="bor_0">
                <span class="same">已取消</span>
                <span class="same allyear_3_num">0</span>
                <span class="price allyear_3_price">0</span>
            </dd>
        </dl>
    </div>

    <div class="year_search_box">
        选择年份
        <input type="text" name="select_year" class="input-text w200 choosetime search_text" autocomplete="off" />
        <a href="javascript:;" class="my_btn" id="seaech_year">搜索</a>
    </div>

    <div class="day_order_table">
        <table width="100%" border="1">
            <tr>
                <th height="38" align="center" bgcolor="#F1F8FB" scope="col"><a class="prev" href="javascript:void(0)"></a></th>
                <th colspan="12" bgcolor="#F1F8FB" scope="col"><span class="year">{$thisyear}</span></th>
                <th align="center" bgcolor="#F1F8FB" scope="col"><a class="next next_unvalid" href="javascript:void(0)"></a></th>
            </tr>
            <tr>
                <td width="63" height="38">&nbsp;</td>
                <td width="63" align="center">1月</td>
                <td width="63" align="center">2月</td>
                <td width="63" align="center">3月</td>
                <td width="63" align="center">4月</td>
                <td width="63" align="center">5月</td>
                <td width="63" align="center">6月</td>
                <td width="63" align="center">7月</td>
                <td width="63" align="center">8月</td>
                <td width="63" align="center">9月</td>
                <td width="63" align="center">10月</td>
                <td width="63" align="center">11月</td>
                <td width="63" align="center">12月</td>
                <td width="63" align="center">合计</td>
            </tr>
            <tr>
                <td rowspan="2" align="center" bgcolor="#F1F8FB">已付款</td>
                <td height="38" align="center" bgcolor="#F1F8FB" class="m1_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m2_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m3_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m4_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m5_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m6_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m7_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m8_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m9_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m10_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m11_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m12_2_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m13_2_num">0</td>
            </tr>
            <tr>
                <td height="38" align="center" bgcolor="#F1F8FB" class="m1_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m2_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m3_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m4_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m5_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m6_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m7_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m8_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m9_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m10_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m11_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m12_2_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m13_2_price">0</td>
            </tr>
            <tr>
                <td rowspan="2" align="center">未付款</td>
                <td height="38" align="center" class="m1_1_num">0</td>
                <td align="center" class="m2_1_num">0</td>
                <td align="center" class="m3_1_num">0</td>
                <td align="center" class="m4_1_num">0</td>
                <td align="center" class="m5_1_num">0</td>
                <td align="center" class="m6_1_num">0</td>
                <td align="center" class="m7_1_num">0</td>
                <td align="center" class="m8_1_num">0</td>
                <td align="center" class="m9_1_num">0</td>
                <td align="center" class="m10_1_num">0</td>
                <td align="center" class="m11_1_num">0</td>
                <td align="center" class="m12_1_num">0</td>
                <td align="center" class="m13_1_num">0</td>

            </tr>
            <tr>
                <td height="38" align="center" class="m1_1_price">0</td>
                <td align="center" class="m2_1_price">0</td>
                <td align="center" class="m3_1_price">0</td>
                <td align="center" class="m4_1_price">0</td>
                <td align="center" class="m5_1_price">0</td>
                <td align="center" class="m6_1_price">0</td>
                <td align="center" class="m7_1_price">0</td>
                <td align="center" class="m8_1_price">0</td>
                <td align="center" class="m9_1_price">0</td>
                <td align="center" class="m10_1_price">0</td>
                <td align="center" class="m11_1_price">0</td>
                <td align="center" class="m12_1_price">0</td>
                <td align="center" class="m13_1_price">0</td>
            </tr>
            <tr>
                <td rowspan="2" align="center" bgcolor="#F1F8FB">已取消</td>
                <td height="38" align="center" bgcolor="#F1F8FB" class="m1_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m2_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m3_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m4_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m5_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m6_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m7_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m8_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m9_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m10_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m11_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m12_3_num">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m13_3_num">0</td>
            </tr>
            <tr>
                <td height="38" align="center" bgcolor="#F1F8FB" class="m1_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m2_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m3_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m4_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m5_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m6_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m7_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m8_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m9_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m10_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m11_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m12_3_price">0</td>
                <td align="center" bgcolor="#F1F8FB" class="m13_3_price">0</td>
            </tr>
        </table>
    </div>
</div>
<input type="hidden" id="year" value="{$thisyear}">

<script>
    var typeid = '{$typeid}';
    var channelname = "{$channelname}";
    $(function(){
        //选择框显示当前年份
        $('input[name=select_year]').val({$thisyear});

        //选择年份
        $('#seaech_year').click(function () {
            var select_year = $('input[name=select_year]').val();
            console.log(select_year);
            $('#year').val(select_year);
            getYearOrder()
        });

        // 日历选择插件加载
        $(".choosetime").click(function(){
            WdatePicker({skin:'whyGreen',dateFmt:'yyyy',minDate:'#{%y-5}',maxDate: '#{%y}'})
        });

        //订单基本统计
        $.getJSON(SITEURL+'order/ajax_sell_tj/typeid/'+typeid,function(data){
            //今日
            $(".today_2_num").html(data.today.pay.num);
            $(".today_2_price").html(data.today.pay.price.toFixed(2));
            $(".today_3_num").html(data.today.cancel.num);
            $(".today_3_price").html(data.today.cancel.price.toFixed(2));
            $(".today_1_num").html(data.today.unpay.num);
            $(".today_1_price").html(data.today.unpay.price.toFixed(2));

            //昨日
            $(".yesterday_2_num").html(data.last.pay.num);
            $(".yesterday_2_price").html(data.last.pay.price.toFixed(2));
            $(".yesterday_3_num").html(data.last.cancel.num);
            $(".yesterday_3_price").html(data.last.cancel.price.toFixed(2));
            $(".yesterday_1_num").html(data.last.unpay.num);
            $(".yesterday_1_price").html(data.last.unpay.price.toFixed(2));

            //本周
            $(".week_2_num").html(data.thisweek.pay.num);
            $(".week_2_price").html(data.thisweek.pay.price.toFixed(2));
            $(".week_3_num").html(data.thisweek.cancel.num);
            $(".week_3_price").html(data.thisweek.cancel.price.toFixed(2));
            $(".week_1_num").html(data.thismonth.unpay.num);
            $(".week_1_price").html(data.thismonth.unpay.price.toFixed(2));

            //本月
            $(".month_2_num").html(data.thismonth.pay.num);
            $(".month_2_price").html(data.thismonth.pay.price.toFixed(2));
            $(".month_3_num").html(data.thismonth.cancel.num);
            $(".month_3_price").html(data.thismonth.cancel.price.toFixed(2));
            $(".month_1_num").html(data.thismonth.unpay.num);
            $(".month_1_price").html(data.thismonth.unpay.price.toFixed(2));

            //全部
            $(".allyear_2_num").html(data.allyear.pay.num);
            $(".allyear_2_price").html(data.allyear.pay.price.toFixed(2));
            $(".allyear_3_num").html(data.allyear.cancel.num);
            $(".allyear_3_price").html(data.allyear.cancel.price.toFixed(2));
            $(".allyear_1_num").html(data.allyear.unpay.num);
            $(".allyear_1_price").html(data.allyear.unpay.price.toFixed(2));
        });

        //订单按年统计
        getYearOrder();

        //去年
        $(".prev").click(function(){
            var year = $("#year").val();
            year = Number(year)-1;
            $(".next").removeClass('next_unvalid');
            $("#year").val(year);
            getYearOrder();
        })

        $(".next").click(function(){
            var year = $("#year").val();
            year = Number(year)+1;
            var myDate = new Date();
            var current_year = myDate.getFullYear();
            if(year>current_year){
                $(".next").addClass('next_unvalid');
                return false;
            }else{
                $("#year").val(year);
                $(".next").removeClass('next_unvalid');
                getYearOrder();
            }
        })


    })
    function getYearOrder()
    {
        var year = $("#year").val();

        $.getJSON(SITEURL+'order/ajax_year_tj/typeid/'+typeid+"/year/"+year,function(data){

            $.each(data,function(i,row){
                //未付款
                $(".m"+i+'_1_num').html(row.unpay.num);
                $(".m"+i+'_1_price').html(row.unpay.price.toFixed(2));
                //已付款
                $(".m"+i+'_2_num').html(row.pay.num);
                $(".m"+i+'_2_price').html(row.pay.price.toFixed(2));
                //已取消
                $(".m"+i+'_3_num').html(row.cancel.num);
                $(".m"+i+'_3_price').html(row.cancel.price.toFixed(2));
            })
            $('.year').html(year);

        })
    }
</script>

</body>
</html>
